package com.lyc.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lyc.dao.UserDao;
import com.lyc.pojo.Users;
import com.lyc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService {
    /*属性区*/
    @Autowired
    private UserDao userDao;//私有属性

    @Override
    public Users login(String utel, String upass) {
        return userDao.login(utel,upass);
    }

    @Override
    public int regist(Users user) {

        return userDao.regist(user);
    }

    public int update(Integer uid,String upass){
        return userDao.updateUser(upass,uid);
    }

    @Override//查询该手机号是否已注册
    public Users selectTel(String utel) {
        return userDao.selectTel(utel);
    }



    /*方法区*/

//后台代码

    @Override
    public Users houtailogin(String name) {
        return userDao.houtailogin(name);
    }

    @Override
    public List<Users> selectAll() {
        return userDao.selectAll();
    }

    @Override
    public PageInfo<Users> getUsersByPage(Integer page, Integer limit) {
        PageHelper.startPage(page,limit);
        List<Users> users=userDao.selectAll();
        return new PageInfo<>(users);
    }

    @Override
    public int delete(int id) {
        return userDao.delete(id);
    }

    @Override
    public int insert(Users users) {
        return userDao.insert(users);
    }

    @Override
    public int update(Users users) {
        return userDao.update(users);
    }

    @Override
    public int deleteSelect(List<String> list) {
        return userDao.deleteSelect(list);
    }
}